package com.block.im.model.param;

import com.block.im.enums.UserTypeEnum;
import com.block.im.util.ImUserUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
public class ImUserParam {

    private String accountId;
    private UserTypeEnum userTypeEnum;

    public String nickname;
    public String headImage;

    public ImUserParam(String accountId, UserTypeEnum userTypeEnum){
        this.accountId = accountId;
        this.userTypeEnum = userTypeEnum;
    }

    public ImUserParam(String imUserId){
        String[] split = imUserId.split(":");
        this.userTypeEnum = UserTypeEnum.getEnumByValue(split[0]);
        this.accountId  =split[1];
    }

    public String getUserId(){
        return ImUserUtil.getUserId(accountId, userTypeEnum);
    }
}
